package cn.iocoder.yudao.module.reading.controller.app.book.vo;

import cn.iocoder.yudao.module.reading.framework.vo.BaseUrlConvertVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 绘本页面 Response VO
 *
 * @author 芋道源码
 */
@Schema(description = "用户 APP - 绘本页面 Response VO")
@Data
@EqualsAndHashCode(callSuper = false)
public class BookPageRespVO extends BaseUrlConvertVO {

    @Schema(description = "页面ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long id;

    @Schema(description = "绘本ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long bookId;

    @Schema(description = "页码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Integer pageNumber;

    @Schema(description = "页面图片URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://example.com/page1.jpg")
    private String imageUrl;

    @Schema(description = "图片宽度", example = "800")
    private Integer imageWidth;

    @Schema(description = "图片高度", example = "600")
    private Integer imageHeight;

    @Schema(description = "页面文字内容", example = "This is a school.")
    private String textContent;

    @Schema(description = "中文翻译内容", example = "这是一所学校。")
    private String chineseTranslation;

    @Schema(description = "文本语言类型", example = "english")
    private String textLanguage;

    @Schema(description = "官方音频URL", example = "https://example.com/audio1.mp3")
    private String officialAudioUrl;

    @Schema(description = "用户录制音频URL", example = "https://example.com/user_audio1.mp3")
    private String userAudioUrl;

    @Schema(description = "音频时长（秒）", example = "30")
    private Integer audioDuration;

    @Schema(description = "阅读难度", example = "easy")
    private String readingDifficulty;

    @Schema(description = "重点词汇列表", example = "[\"school\", \"children\"]")
    private List<String> keyWords;

    /**
     * 转换URL字段
     * 将相对路径转换为完整URL
     */
    @Override
    public void convertUrls() {
        this.imageUrl = convertUrl(this.imageUrl);
        this.officialAudioUrl = convertUrl(this.officialAudioUrl);
        this.userAudioUrl = convertUrl(this.userAudioUrl);
    }
}
